<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加报告</title>
    <link rel="stylesheet" href="../../../static/layui/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../static/layui/dist/layuiadmin/style/admin.css" media="all">
    <script src="../../../static/layui/dist/layuiadmin/layui/layui.js"></script>
    <script src="../js/jquery.min.js"></script>
</head>
<body>
    
<form class="layui-form" action="" lay-filter="example">
    <div class="layui-form-item layui-form-text">
        
        <div class="layui-input-block">
            <textarea id="demo" style="display: none;" ></textarea>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
        </div>
      </div>
    </form>



<script>
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate
  ,$ = layui.jquery;
  var editIndex = layedit.build('demo');

  form.on('submit(demo1)', function(){
    var value = layedit.getText(editIndex)
    var params = {
        "content" :value
    }
    $.ajax({
        type:"post",
        dataType:"json",
        contentType:'application/json',
        url:"/workreport/add",
        data:JSON.stringify(params),
            success:function(res){
                if(res.code==200){
                  location.reload()
                    alert("录入成功");
                }
            }
    })

    return false;
  });

    //表单赋值

});
    // layui.use('form', function(){
    // var form = layui.form;
    // //自定义验证规则
    // form.verify({
    // title: function(value){
    // if(value.length < 5){
    // return '标题至少得5个字符啊';
    // }
    // }
    // });
    // });

    
</script>
</body>
</html>